package br.com.viamais.business;

import java.io.Serializable;
import java.util.List;

import br.com.viamais.model.User;

/**
 * Interface to user business.
 * 
 * @author Eduardo
 */
public interface IUserBO extends Serializable {

	/**
	 * Get by user name and password.
	 * 
	 * @param String: user name.
	 * @param String: password.
	 * 
	 * @return User: user.
	 * 
	 * @throws Throwable: connections issues.
	 */
	public abstract User getByUserNamePassword(String username, String password)
			throws Throwable;

	/**
	 * Save a user.
	 * 
	 * @param User: user.
	 * 
	 * @throws Throwable: connections issues.
	 */
	public abstract void saveOrUpdate(User user) throws Throwable;

	/**
	 * Get by user id.
	 * 
	 * @param Integer: id
	 * 
	 * @return User: user.
	 * 
	 * @throws Throwable: connections issues.
	 */
	public abstract User getById(Integer id) throws Throwable;

	/**
	 * Load a proxy of user.
	 * 
	 * @param Integer: user id.
	 * 
	 * @return User: user.
	 * 
	 * @throws Throwable: connections issues.
	 */
	public abstract User load(Integer id) throws Throwable;

	/**
	 * Get by email.
	 * 
	 * @param String: email.
	 * 
	 * @return User: user.
	 * 
	 * @throws Throwable: connections issues.
	 */
	public abstract User getByEmail(String email) throws Throwable;

	/**
	 * Get all.
	 * 
	 * @return List<User>: all users.
	 * 
	 * @throws Throwable: connections issues.
	 */
	public abstract List<User> getAll() throws Throwable;

	/**
	 * Delete a user.
	 * 
	 * @param User: user
	 * @throws Throwable: connections issues.
	 */
	public abstract void delete(User user) throws Throwable;

	/**
	 * Get by name or user name.
	 * 
	 * @param String: name.
	 * @param String: user name.
	 * 
	 * @return List<User>: encountered users.
	 * 
	 * @throws Throwable: connections issues.
	 */
	public abstract List<User> getByNameUsername(String name, String username)
			throws Throwable;

}